<?php
	/**
		This file is part of PEL.
		
		PEL is free software: you can redistribute it and/or modify
		it under the terms of the GNU General Public License as published by
		the Free Software Foundation, either version 3 of the License, or
		(at your option) any later version.
		
		PEL is distributed in the hope that it will be useful,
		but WITHOUT ANY WARRANTY; without even the implied warranty of
		MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
		GNU General Public License for more details.
		
		You should have received a copy of the GNU General Public License
		along with PEL.  If not, see <http://www.gnu.org/licenses/>.
	* Elgg pel add entry page
	*/

	// Load Elgg engine
		require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
		gatekeeper();
		
	// Get the current page's owner
		$page_owner = page_owner_entity();
		if ($page_owner === false || is_null($page_owner)){
			$page_owner = $_SESSION['user'];
			set_page_owner($_SESSION['guid']);
		}
	
	// Get the pel entity
    if ($ent = get_entities("object",'pel',$_SESSION['guid'])){
      $area2 = elgg_view_title(elgg_echo('pel:edit'));
      $area2 .= elgg_view("pel/forms/edit", array('entity' => $ent[0]));
      $body = elgg_view_layout("two_column_left_sidebar", $area1, $area2);
    }
	// Display page
	page_draw(elgg_echo('pel:edit'),$body);
?>